package com.lwq.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lwq.entity.Role;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 会员表 Mapper 接口
 * </p>
 *
 * @author lwq
 * @since 2023-02-13
 */
@Repository
public interface RoleMapper extends BaseMapper<Role> {

    /**
     * 按用户表主键查询该用户的全部角色
     *
     * @param memberId 用户表主键
     * @return 该用户的全部角色
     */
    @Select("select r.role_id, r.role_title, r.role_info, r.create_time, r.last_modify " +
            "from alibaba.role r " +
            "where r.role_id in ( " +
            "    select role_id from alibaba.member_role mr where mr.member_id = #{param1} " +
            ")")
    List<Role> selectRolesByMemberId(Integer memberId);

}
